import java.util.Random;
import java.util.Scanner;

public class J20250319 {
   /* public static void main(String[] args) {
        int a=0;
        int result=0;
        int result1=0;
        for(int i=0;i<101;i++){
            if(i%2==0){
                result+=i;
            }
            else{
                result1+=i;
            }
        }
        System.out.println("偶数的和:"+result);
        System.out.println("奇数的和:"+result1);
    }*//*

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        Random random=new Random();
        int ToGuess=random.nextInt(100);
        System.out.println("要猜的数字为："+ToGuess);
       *//* int num=1;
        do{
            System.out.println(num);
            num++;
        }while(num<=10);*//*
    }*/
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int a=sc.nextInt();
       int b=sc.nextInt();
       /*int a=24;
       int b=18;*/
       int c=a%b;
       while(c!=0){
           a=b;
           b=c;
           c=a%b;
       }
       System.out.println("最大公约数为："+b);

   }
}

